const env = process.env.NODE_ENV || 'local';
module.exports = {
  //设置cookie
  set(res, value, _tk = 'token') {
    let _curDate = new Date();
    res.cookie(_tk, value, {
      expires: new Date(_curDate.setHours(_curDate.getHours() + 1)),
      httpOnly: true,
      secure: "local" != env ? true : false,
      domain: env === 'local' ? '' : '.tax.deloitte.com.cn'
    });
  },
  //清除cookie
  remove(res, _tk = 'token') {
    let _curDate = new Date();
    res.cookie(_tk, '', {
      expires: new Date(_curDate.setHours(_curDate.getHours() - 1)),
      httpOnly: true,
      secure: "local" != env ? true : false,
      domain: env === 'local' ? '' : '.tax.deloitte.com.cn'
    });
  }
}
